package com.doit.day03

object _08_元祖 {
  def main(args: Array[String]): Unit = {
    //元祖  是一个类
    val tuple: (String, Int) = new Tuple2[String, Int]("zss", 18)

    val tuple1: (String, Int) = Tuple2("zss", 18)

    val tuple2: (String, Int) = ("zss", 18)
    val value: String = tuple2._1
    val value1: Int = tuple2._2

    //有时候 可以将元祖拿过来当类和对象来使用   id   name   age   gender

    val tuples: List[(Int, String, Int, String)] = List((1, "zss", 18, "male"), (2, "lss", 18, "male"), (3, "wemz", 19, "female"))
    for (elem <- tuples) {
      val id: Int = elem._1
      val name: String = elem._2
      val age: Int = elem._3
      val gender: String = elem._4
    }


  }

}
